﻿namespace checc_baseTools
{
    public static class ModelAndView
    {
        ///// <summary>
        ///// 创建Model
        ///// </summary>
        ///// <param name="modelId">模型空间id</param>
        ///// <param name="modelName">新建模型空间名称</param>
        ///// <param name="modelType">新建模型空间类型</param>
        ///// <returns></returns>
        //public static BPModel createModel(BPModelId modelId, string modelName, BPModelType modelType)
        //{
        //    BPProject project = BIMBase.Core.BPApplication.getInstance().getProjectManager().getMainProject();

        //    project.createNewModel(modelId, modelName, modelType);
        //    BPModel newModel = doc.modelManager.getModelById(modelId);
        //    return newModel;
        //}

        ///// <summary>
        ///// 根据Id删除Model模型
        ///// </summary>
        ///// <param name="modelId">模型空间id</param>
        ///// <returns></returns>
        //public static BPStatus deleteModelById(BPModelId modelId)
        //{
        //    return BPApplication.singleton().activeDocument.modelManager.deleteModelById(modelId);
        //}

        ///// <summary>
        ///// 更改Model模型的名字
        ///// </summary>
        ///// <param name="model">模型空间</param>
        ///// <returns></returns>
        //public static BPModel setModelName(BPModel model)
        //{
        //    model.sDisplayName = "aaa";
        //    return model;
        //}

        ///// <summary>
        ///// 激活Model
        ///// </summary>
        ///// <param name="modelId">模型空间id</param>
        ///// /// <param name="viewNum">视图号</param>
        //public static void activationModel(BPModelId modelId, int viewNum)
        //{
        //    BPApplication.singleton().activeDocument.viewManager.displayModelOnViewPort(modelId, viewNum);
        //}

        ///// <summary>
        ///// 打开View
        ///// </summary>
        //public static void openView()
        //{
        //    //获取当前激活的工程
        //    BPDocument doc = BPApplication.singleton().activeDocument;

        //    //在当前激活的工程创建view
        //    IntPtr viewPtr = doc.viewManager.createView();

        //    //获取创建view的number
        //    int nNum = doc.viewManager.getViewNumber(viewPtr);

        //    //创建新的model
        //    BPModelId modelId = new BPModelId();

        //    doc.modelManager.createNewModel(modelId, "cshapModel", BPModelType.enPhysical);

        //    //创建的新model在新view中显示
        //    doc.viewManager.displayModelOnViewPort(modelId, nNum);
        //}

        ///// <summary>
        ///// 布局View
        ///// </summary>
        ///// <param name="modelId1">模型空间id</param>
        //public static void layoutView(BPModelId modelId1)
        //{
        //    System.IntPtr pView = BPApplication.singleton().activeDocument.viewManager.createView();
        //    int nNum = BPApplication.singleton().activeDocument.viewManager.getViewNumber(pView);

        //    BPApplication.singleton().activeDocument.viewManager.displayModelOnViewPort(modelId1, 0);
        //}
    }
}
